package com.itheima.service.smsService.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.domain.db.cms.CmsSubjectProductRelation;
import com.itheima.mapper.cmsMapper.CmsSubjectProductRelationMapper;
import com.itheima.service.cmsService.CmsSubjectProductRelationService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class CmsSubjectProductRelationServiceImpl implements CmsSubjectProductRelationService {
    @Autowired
    CmsSubjectProductRelationMapper cmsSubjectProductRelationMapper;
    @Override
    public void add(CmsSubjectProductRelation relation) {
        cmsSubjectProductRelationMapper.insert(relation);
    }

    @Override
    public List<CmsSubjectProductRelation> getInfoByBrandId(Long id) {
        LambdaQueryWrapper<CmsSubjectProductRelation> lqw = new LambdaQueryWrapper<>();
        lqw.eq(CmsSubjectProductRelation::getProductId,id);
        return cmsSubjectProductRelationMapper.selectList(lqw);
    }

    @Override
    public void update(CmsSubjectProductRelation relation) {
        cmsSubjectProductRelationMapper.updateById(relation);
    }
}
